package com.lzxuni.service.impl;

import java.util.Iterator;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lzxuni.mapper.QxDataMapper;
import com.lzxuni.mapper.YongHuMapper;
import com.lzxuni.po.QxDataCostom;
import com.lzxuni.po.YongHu;
import com.lzxuni.po.YongHuCustom;
import com.lzxuni.service.YongHuService;

/**
 *@Title DeptServiceImpl.java
 *@description TODO
 *@author 孙志强
 *@time 2016年11月4日 下午4:51:58
 *@version 1.0
 **/
@Service("yongHuService")
public class YongHuServiceImpl implements YongHuService {
	@Autowired
	private YongHuMapper yongHuMapper;
	
	@Autowired
	private QxDataMapper qxDataMapper;

	
	@SuppressWarnings({ "unchecked", "rawtypes" })
	@Override
	public PageInfo<?> findYongHuList(int pageNumber, int pageSize,YongHuCustom yongHuCustom) throws Exception {
		PageHelper.startPage(pageNumber, pageSize).setOrderBy("id desc");
		List<YongHuCustom> list = yongHuMapper.findYongHuList(yongHuCustom);
		
		PageInfo pageInfo = new PageInfo(list);
		return pageInfo;
	}

	@Override
	public  YongHu findYongHuById(String userkey) throws Exception {
		return yongHuMapper.findYongHuById(userkey);
	}

	@Override
	public void insertYongHu(YongHu yongHu) throws Exception {
		yongHuMapper.insertYongHu(yongHu);
	}

	@Override
	public void delYongHu(String id) throws Exception {
		yongHuMapper.delYongHu(id);
	}

	@Override
	public void updateYongHu(YongHu yongHu) throws Exception {
		yongHuMapper.updateYongHu(yongHu);
	}
	@Override
	public List<YongHuCustom> findYongHutList(YongHuCustom yongHuCustom) throws Exception {
	/*	List<YongHuCustom> yongHuCustoms=yongHuMapper.findyongHutList(yongHuCustom);
		Iterator<YongHuCustom> it=yongHuCustoms.iterator();
		while (it.hasNext()) {
			YongHuCustom yongHuCustom2 =it.next();
			QxDataCostom qxDataCostom=new QxDataCostom();
			landCustom.setDeptId(yongHuCustom2.getId());
			List<LandCustom> landCustoms=landService.findLandList(landCustom);
			deptCustom2.setLandList(landCustoms);
		}
		return deptCustoms;*/
		return yongHuMapper.findYongHuList(yongHuCustom);
	}
/*	@Override
	public Dept findDeptById(String id) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}
	*/


	
}
